package com.bw.yk10.func;

import org.apache.flink.table.functions.FunctionDefinition;
import org.apache.flink.table.functions.ScalarFunction;
import com.alibaba.fastjson.JSONObject;

import java.io.Serializable;


public class JsonParserFunction extends ScalarFunction implements Serializable {
    public String eval(String jsonString, String field) {
        if (jsonString == null || field == null) {
            return null;
        }

        JSONObject jsonObject = JSONObject.parseObject(jsonString);
        return jsonObject.getString(field);
    }
}